package com.pavan.gps;

import com.pavan.nightgps.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class addLoc extends Activity {
	
	private DbHelper mDbHelper;
	private EditText latitude;
	private EditText longitude;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_loc);
		mDbHelper = new DbHelper(this);
		mDbHelper.open();
		Bundle listName = getIntent().getExtras();
		latitude = (EditText) findViewById(R.id.LatitudeText);
		longitude = (EditText) findViewById(R.id.LongitudeText);
		Button b=(Button) findViewById(R.id.ConfirmButton);
		
		
		
		b.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				
				Toast.makeText(addLoc.this, "Button Clicked",Toast.LENGTH_LONG).show();
				saveItemData();
			}

		});
		
		//Intent i = new Intent(this, ListEdit.class);
 		//i.putExtra(DbHelper.LIST_ROWID, id);
 		//startActivityForResult(i, ACTIVITY_EDIT);
		
	}
	
	private void saveItemData() {
		String latitude_name = latitude.getText().toString();
		String longitude_name = longitude.getText().toString();
		mDbHelper.addItem(latitude_name, longitude_name);
		
		
	}

}